<?php
session_start();
require('../../connections/con_gl.php'); 
mysql_select_db($database_con_gl, $con_gl);
$area = $_REQUEST['area'];
list($namaarea) = mysql_fetch_row(mysql_query("select area from gl_area where id='$area'"));
?>
<!--<p><a style="cursor:pointer;" onclick="window.print();"><img src="images/_print.PNG" />&nbsp;&nbsp;Cetak</a></p>-->
<table width="100%" border="1" cellspacing="0" cellpadding="3">
	<tr style="text-align:center;background-color:#eee">
		<th colspan="7">STOK KENDARAAN RENTAL CABANG <?php echo strtoupper($namaarea); ?></th>
	</tr>
	<tr style="text-align:center;background-color:#eee">
		<th width="3%">No.</th>
		<th width="40%">Cabang</th>
		<th width="10%">Coorporate</th>
		<th width="10%">Retail</th>
		<th width="10%">Tugas Kantor</th>
		<th width="10%">OPS / UGC</th>
		<th width="17%">Jumlah</th>
	</tr>
	<?php
	$str = "select id, gudang from gl_gudang ";
	if($area != '') $str .= "where area = '$area'";
	$query = mysql_query($str) or die (mysql_error());
	$totdata = mysql_num_rows($query);
	if($totdata == '0'){
	echo "<tr><td colspan='7' align='center'><i>Data belum ada</i></td></tr>";
	}else{
	$no=1;
	while(list($idgudang, $namagudang) = mysql_fetch_row($query)){
	echo "<tr>";
	echo "<td align='center'>$no.</td>";
	echo "<td align='left'>$namagudang</td>";
	list($jumcorporate) = mysql_fetch_row(mysql_query("select count(*) from gl_masterkendaraan where cabang = '$idgudang' and unitstok='1'"));
	if($jumcorporate=='0') $jumcorporate='';
	echo "<td align='center'>$jumcorporate</td>";
	list($jumretail) = mysql_fetch_row(mysql_query("select count(*) from gl_masterkendaraan where cabang = '$idgudang' and unitstok='2'"));
	if($jumretail=='0') $jumretail='';
	echo "<td align='center'>$jumretail</td>";
	list($jumtugaskantor) = mysql_fetch_row(mysql_query("select count(*) from gl_masterkendaraan where cabang = '$idgudang' and unitstok='3'"));
	if($jumtugaskantor=='0') $jumtugaskantor='';
	echo "<td align='center'>$jumtugaskantor</td>";
	list($jumoperasional) = mysql_fetch_row(mysql_query("select count(*) from gl_masterkendaraan where cabang = '$idgudang' and unitstok='4'"));
	if($jumoperasional=='0') $jumoperasional='';
	echo "<td align='center'>$jumoperasional</td>";
	$jumtotal = $jumretail + $jumcorporate + $jumtugaskantor + $jumoperasional;
	if($jumtotal == 0) $jumtotal='';
	echo "<td align='center'>$jumtotal</td>";
	echo "</tr>";
	$no++;
	}
	}
	?>
</table>
<div id="box-exportdata">
<a href="doc/laporanJumlahCabangPDF.php?area=<?php echo $area;?>" title="Export PDF"><img src="images/_print.png" border="0" /></a><br /><br />
<a href="doc/laporanJumlahCabangExcel.php?area=<?php echo $area; ?>&amp;files='Stok Kendaraan Cabang'" title="Export Excel"><img src="images/_xls.png" border="0" /></a><br /><br />
<a href="doc/laporanJumlahCabangDoc.php?area=<?php echo $area; ?>&amp;files='Stok Kendaraan Cabang'" title="Export Word"><img src="images/_word.png" border="0" /></a>
</div>
<p>&nbsp;</p>